from bytehouse_driver import Client

if __name__ == '__main__':
    HOST=""
    PORT=""
    ACCOUNT=""
    USER=""
    PASSWORD=""
    # Passing Parameters
    client = Client(
        host=HOST,
        port=PORT,
        account=ACCOUNT,
        user=USER,
        password=PASSWORD,
        secure = "true"
    )

    ### DDL Query
    client.execute("CREATE DATABASE demo_db")
    client.execute("CREATE TABLE demo_db.demo_tb (id INT) ENGINE=CnchMergeTree() ORDER BY tuple()")

    ### DML Query
    client.execute("INSERT INTO demo_db.demo_tb VALUES", [[1], [2], [3]])

    ### DQL Query
    result_set = client.execute("SELECT * FROM demo_db.demo_tb")
    for result in result_set:
        print(result)

    client.execute("DROP DATABASE demo_db")